"""
    Contoller for salary deduction table.
"""

from mnemoply import model
from mnemoply.controllers.lookup import LookupController, TableCol, TableLookupDataSource
from mnemoply.controllers.crud import CRUDController

class SalaryDeductionController(LookupController, CRUDController):
    model_object = model.SalaryDeduction
    lookup_columns = [
        TableCol(name='teacher', caption=_('Teacher')),
        TableCol(name='group_title', caption=_('Group')),
        TableCol(name='start_date', caption=_('Start date')),
        TableCol(name='end_date', caption=_('End date')),
    ]
    view_fields = ['teacherID', 'groupID', 'startDate', 'endDate']

    def __init__(self):
        LookupController.__init__(self,
            data_source=TableLookupDataSource('salary_deduction_lookup'),
            columns=self.lookup_columns,
            title=self.model_object.model_title,
        )
        CRUDController.__init__(self, model_object=self.model_object)

exposed = SalaryDeductionController()
